package com.grantheath.erebus.controller.transitionManagers.linearTransitionManagers
{
	import com.grantheath.erebus.model.enum.notifications.ErebusPageLoaderNotifications;
	import com.grantheath.erebus.model.interfaces.IErebusPageLoaderProxy;
	import com.grantheath.erebus.model.interfaces.IErebusPageNode;
	import com.grantheath.erebus.model.enum.names.ErebusProxyNames;

	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 * @author grantheath
	 */
	public class ErebusLoadPageCommand extends SimpleCommand implements ICommand 
	{
		override public function execute(notification : INotification) : void
		{
			var pageNode : IErebusPageNode = notification.getBody() as IErebusPageNode;
			var pageLoader : IErebusPageLoaderProxy = facade.retrieveProxy(ErebusProxyNames.PAGE_LOADER_PROXY) as IErebusPageLoaderProxy;
			
			trace("loading page: " + pageNode);
			pageLoader.loadPage(pageNode);
			sendNotification(ErebusPageLoaderNotifications.PAGE_LOADING, pageNode);
		}
	}
}
